###
events: ['changed']
###
class tree.ui.Entry extends tree.ui.Widget
    constructor: () ->
        super
        @htmlelem = document.createElement 'input'
        @htmlelem.type = 'text'
        @htmlelem.className = 'tree-entry'
        @connect 'button-release', @button_release
    
    button_release: (widget, evt) =>
        @emit 'changed', {value: @htmlelem.value}
    
    set_password: (pwd) ->
        if pwd
            if not password?
                @htmlelem.value = ''
                @password = pwd
                @htmlelem.type = 'password'
        
        else
            if @password?
                @htmlelem.value = ''
                @password = pwd
                @htmlelem.type = 'text'
    
    set_text: (text) ->
        @htmlelem.value = text
    
    get_text: () ->
        @htmlelem.value
